package goodenglish.domain.domainevent;

import java.util.ArrayList;
import java.util.List;

public class DomainEvents {
	private static List<DomainEvent> actions;
	private static List<Handles> handles;

	public static <T extends DomainEvent> void register(T callback) {
		if (actions == null) {
			actions = new ArrayList<DomainEvent>();
		}
		actions.add(callback);
	}

	public static <T extends DomainEvent> void raise(T args) {
		for (Handles<DomainEvent> handle : handles) {
			handle.handle(args);
		}

	}
}
